<?
if (isset($_POST['btnsubmit'])) {
    require("required/dbconnect.php");

    $name_eng = $_POST['name_eng'];
    $area_type = $_POST['area_type'];

    $insert = mysql_query("insert into os_country(engname,area_type)value('$name_eng','$area_type')") or die(mysql_error());
    header("Location:country_view_all.php");
}

require("required/dbconnect.php");
require("required/header.php");
require("required/function.php");
checkAccess("allow_shipping_management", 1);

$get = mysql_query("select * from os_country order by engname asc");
?>

<font class="title">Country Management</font><br><br>
<table width="100%" cellpadding="3" class="solidborder">
    <tr class="table_header" align="center" height="20">
        <td width="3%">No</td><td width="26%">Country Name</td><td width="20%">ISO Name</td><Td width="24%">Area Type</Td>
        <td width="20%">Publish</td>
       <td width="15%">Action</td>
    </tr>
<?
if (mysql_num_rows($get) == 0) {
    ?>
        <tr>
            <td align=center colspan="6"> - No record -</td>
        </tr>
    <?
} else {
    $no = 1;
    while ($a = mysql_fetch_array($get, MYSQL_ASSOC)) {
        $id = $a['id'];
        if ($no % 2 == 0) {
            $class1 = "table_item_even";
            $class2 = "table_item_odd";
        } else {
            $class1 = "table_item_odd";
            $class2 = "table_item_even";
        }


        if ($a['area_type'] == "") {
            $area_type = "State";
        } else {
            $area_type = $a['area_type'];
        }
        ?>
            <tr height="20" valign="top" class="<?= $class1 ?>"  onmouseover="this.className='table_item_mouseover'" onmouseout="this.className='<?= $class1 ?>'">
                <td align="center"><?= $no ?></td><td><?= $a['engname'] ?></td>
                <td><?= $a['iso3'] ?></td>
                <td><?= $area_type ?></td>
                <td><?= $a['status']==1?"Yes":"No" ?></td>                
                <td align="center">
                    <a href="country_view_full.php?id=<?= $id ?>"><img src="images/icons/view_icon.gif" border="0" /></a>
                </td>								
            </tr>
            <?
            $no++;
        }
    }
    ?>
</table>
<script language="javascript">
    function frmValidate(frm1)
    {
								
								
        if(document.frm1.name_eng.value=="")
        {
            alert("Please enter contry name");
            document.frm1.name_eng.focus();
            return false;
        }
								
								
																
        return true;
    }
								
</script>
<br /><br />

</td>


<? require("required/footer.php"); ?>